import tkinter as tk
from tkinter import  ttk


"""
实现简单的输入框，获取输入框信息
"""

def show():
    print(name_va.get())
def download():
    print(num_va.get())


#创建界面
root = tk.Tk()
root.title('小说下载器')

root.geometry('500x500+200+200')

#设置可变变量
name_va = tk.StringVar()

search_frame = tk.Frame(root)
search_frame.pack(pady=10)
tk.Label(search_frame,text='小说名称：',font=('宋体',10)).pack(side=tk.LEFT,padx=10)
tk.Entry(search_frame,width=20,textvariable=name_va).pack(side=tk.LEFT)

num_va = tk.StringVar()
download_frame = tk.Frame(root)
download_frame.pack(pady=10)
tk.Label(download_frame,text='下载：',font=('宋体',10)).pack(side=tk.LEFT,padx=20)
tk.Entry(download_frame,width=20,textvariable=num_va).pack(side=tk.LEFT,padx=10)

button_frame = tk.Frame(root)
button_frame.pack(pady=10)
tk.Button(button_frame,text='搜索',width=10,command=show).pack(side=tk.LEFT,padx=10)
tk.Button(button_frame,text='下载',width=10,command=download).pack(side=tk.LEFT,padx=10)


root.mainloop()
